package com.linkwedo.saas.project;

import java.util.List;

import com.linkwedo.saas.domain.ProjectReview;


public class ProjectReviewService {
	private ProjectReviewDao projectReviewDao;

	public ProjectReviewDao getProjectReviewDao() {
		return projectReviewDao;
	}

	public void setProjectReviewDao(ProjectReviewDao projectReviewDao) {
		this.projectReviewDao = projectReviewDao;
	}

	public ProjectReview getProjectReview(ProjectReview projectReview) {
		List<ProjectReview> uList = getProjectReviewDao().findByExample(projectReview);
		return uList.get(0);
	}
	public ProjectReview getProjectReviewById(Integer projectReviewId) {
		ProjectReview projectReview= (ProjectReview)getProjectReviewDao().findByProperty("id",projectReviewId).get(0);
		return projectReview;
	}
	public void save(ProjectReview transientInstance) {		
		try {
			getProjectReviewDao().save(transientInstance);		
		} catch (RuntimeException re) {			
			throw re;
		}
	}
	
	public List findAll() {		
		try {
			return getProjectReviewDao().findAll();
		} catch (RuntimeException re) {
			throw re;
		}
	}
	
	
	public List findByProjectID(Integer projectId) {		
		try {
			return getProjectReviewDao().findByProjectId(projectId);
		} catch (RuntimeException re) {
			throw re;
		}
	}
	
	public void deleteById(Integer pid) {		
		try {
			ProjectReview transientInstance = getProjectReviewDao().findById(pid);
			transientInstance.setId(pid);
			getProjectReviewDao().delete(transientInstance);		
		} catch (RuntimeException re) {			
			throw re;
		}
	}
	
}
